package com.qf.exception.homework;

import java.util.ArrayList;
import java.util.List;
import java.util.Random;

public class Cat {

    private String name;

    private String sex;

    private Integer age;


    public static final String[] CAT_NAMES ={"机器猫","加菲猫","蓝猫","红猫","猫雷","英短","波斯猫","HelloKit"};

    public static final String[] SEX = {"MALE","FEMALE"};

    public Cat() {
    }

    public Cat(String name, String sex, Integer age) {
        this.name = name;
        this.sex = sex;
        this.age = age;
    }

    @Override
    public String toString() {
        return "Cat{" +
                "name='" + name + '\'' +
                ", sex='" + sex + '\'' +
                ", age=" + age +
                '}';
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public String getSex() {
        return sex;
    }

    public void setSex(String sex) {
        this.sex = sex;
    }

    public Integer getAge() {
        return age;
    }

    public void setAge(Integer age) {
        this.age = age;
    }

    public static Cat randomCat(){

        // 随机名字
        Random random = new Random();
        String catName = CAT_NAMES[random.nextInt(CAT_NAMES.length)]+random.nextInt(1000);
        String sex1 = SEX[random.nextInt(2)];
        int age = random.nextInt(100);
        return new Cat(catName, sex1, age);
    }

    public static List<Cat> randomCats(int num){

        ArrayList<Cat> cats = new ArrayList<>();

        for (int i=0;i<num;i++) {
            cats.add(randomCat());
        }

        return cats;

    }

}
